package jhlee42;

import java.util.Scanner;

public class J08SungJuk {
	// 배열을 이용한 성적 처리

	public static void main(String[] args) {
		// 변수 선언
		
		String name[] = new String[4];
		
		int student_numer;
		int kor[] = new int[400];
		int eng[] = new int[400];
		int mat[] = new int[400];
		int tot[] = new int[400];
		int avg[] = new int[400];
		char grd[] = new char[400];
		String index = "이름" + "\t" + "국어" + "\t" + "영어" + "\t" + "수학" + "\t" + "총점"+ "\t" + "평균" + "\t" + "학점" + "\n";
		
		
		Scanner sc = new Scanner(System.in);
		String result[] =new String[4];
		
		// 입력 및 성적처리
		System.out.println("입력하시는 학생은 몇 명 입니까??");
		student_numer = sc.nextInt();
				
		for (int i = 1; i <= student_numer; i++) {		
			result[i] = "";
			System.out.println("이름은?");
			name[i]=sc.next();
			System.out.println("국어,영어,수학 순서대로 점수를 넣어주세요..");
			kor[i]=sc.nextInt();
			eng[i]=sc.nextInt();
			mat[i]=sc.nextInt();	
			
			tot[i] = kor[i]+eng[i]+mat[i];
			avg[i] = tot[i]/3;
			
			switch ((int)avg[i]/10) {
			case 10:  
			case 9: grd[i] = '수'; break;
			case 8: grd[i] = '우'; break;
			case 7: grd[i] = '미'; break;
			case 6: grd[i] = '양'; break;
			default:grd[i] = '가';
			}
			result[i] += name[i] + "\t" + kor[i] + "\t" + eng[i] + "\t" + mat[i] + "\t" + tot[i]+ "\t" + avg[i]+ "\t" + grd[i]+ "\n";
		}	
		// 결과 출력
		System.out.println(index);
		System.out.println("------------------------------------------------------------------");
		for (int j = 1; j <= student_numer; j++) {
			System.out.println(result[j]);
		}	
	}
}
